/*
 * Copyright (C) 2008 Rob Cash
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * 	http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.robcash.commons.swing.wizard;

import java.awt.Component;
import javax.swing.event.ChangeListener;

/**
 * Wizard panel
 * @author Rob
 * @param <T> Component
 */
public interface WizardPanel<T extends Component> {

    /**
     * Get the unique identifier for this wizard panel
     * @return unique identifier
     */
    public String getId();

    /**
     * Indicates if this panel allows backwards traversal
     * @return true if this panel allows the user to go "back"
     */
    public boolean canGoBack();
    
    /**
     * Indicates if this panel allows forwards traversal
     * @return true if this panel allows the user to go "forward"
     */
    public boolean canGoForward();

    /**
     * Indicates if this panel allows the wizard to complete
     * @return true if this panel allows the user to "finish"
     */
    public boolean canFinish();

    /**
     * Get the next wizard panel's identifier
     * @return Wizard panel identifier. If the value is <tt>null</tt>, then
     * this panel does not have a next panel.
     */
    public String getNextPanelId();

    /**
     * Get the visual component wrapped by this wizard panel
     * @return Component
     */
    public T getComponent();

    /**
     * Set the visual component wrapped by this wizard panel
     * @param component Component to set
     */
    public void setComponent(T component);

    /**
     * Indicates that the wizard panel is about to be displayed
     * @param wizard Wizard that is about to display this panel
     */
    public void aboutToDisplay(Wizard wizard);

    /**
     * Indicates that the wizard panel has just been displayed
     * @param wizard Wizard that has just displayed this panel
     */
    public void displayed(Wizard wizard);

    /**
     * Indicates that the wizard panel is about to be displayed
     * @param wizard Wizard that is about to hide this panel
     * @param saveWork Indicates whether or not work should be saved
     */
    public void aboutToHide(Wizard wizard, boolean saveWork);

    /**
     * Add a change listener
     * @param listener Listener to add
     */
    public void addChangeListener(ChangeListener listener);

    /**
     * Remove a change listener
     * @param listener Listener to remove
     */
    public void removeChangeListener(ChangeListener listener);

}
